Visualize the exchange
If we receive a new calculation from someone, usually it is easier to quickly look at some figures and aggregated data to figure out what is going on, than reading the system parameters from the simulation files. For this purpuse grogupy has a few tools to quickly and efficiently visualize the basic informations and print a summary of the calculation.
First import grogupy, which will import the most important classes, functions and variables in its namespace.
[ ]:
import grogupy
################################################################################
# this is just for the html export of interactive figures, but it is not part of
# grogupy
import plotly
plotly.offline.init_notebook_mode()
################################################################################
/Users/danielpozsar/Documents/studies/elte/phd/grogu/.venv/lib/python3.12/site-packages/grogupy/_tqdm.py:26: TqdmWarning: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html
from tqdm.autonotebook import tqdm
The most useful format for post-processing is the .pkl format, because you can load the grogupy.Builder instance. Depending on the compression level you can do everything with it that is done in the Calculate magnetic parameters tutorial or just some basic plotting and convenient data accesing. Let’s suppose for now, that we got a maximally compressed Builder instance in a .pkl format. All the compression levels can be loaded the same way.
[2]:
system = grogupy.load("./../../../../tests/test_builder.pkl")
system
[2]:
<grogupy.Builder npairs=3, numk=1, kset=[1 1 1], eset=100>
We can look at the representations of the instance, to get a feeling of the system.
[3]:
system.kspace
[3]:
<grogupy.Kspace kset=[1 1 1], NK=1>
[4]:
system.contour
[4]:
<grogupy.Contour emin=-8.074511730000001, emax=0, eset=100, esetp=10000>
[5]:
system.magnetic_entities
[5]:
[<grogupy.MagneticEntity tag=0Cr(l:2), SBS=20>,
<grogupy.MagneticEntity tag=1Cr(l:2), SBS=20>,
<grogupy.MagneticEntity tag=2Cr(l:2), SBS=20>]
[6]:
system.pairs
[6]:
[<grogupy.Pair tag1=0Cr(l:2), tag2=1Cr(l:2), Ruc=[0 0 0]>,
<grogupy.Pair tag1=1Cr(l:2), tag2=2Cr(l:2), Ruc=[0 0 0]>,
<grogupy.Pair tag1=2Cr(l:2), tag2=0Cr(l:2), Ruc=[0 0 0]>]
Or get a concise summary of the simulation.
[7]:
print(system)
================================================================================
grogupy version: 0.0.7
Input file: ../benchmarks/Cr3/Cr3.fdf
Spin mode: SPIN-ORBIT
================================================================================
SLURM job ID: Could not be determined.
Architecture: CPU
Number of nodes in the parallel cluster: 1
Parallelization is over: K
Solver used for Greens function calculation: Sequential
Solver used for Exchange tensor: grogupy
Solver used for Anisotropy tensor: grogupy
================================================================================
Cell [Ang]:
1.442498074906033700e+01 -2.498479955557547072e+01 0.000000000000000000e+00
1.442498074906033700e+01 2.498479955557547072e+01 0.000000000000000000e+00
0.000000000000000000e+00 0.000000000000000000e+00 2.884996149812067401e+01
================================================================================
DFT axis: [0 0 1]
Quantization axis and perpendicular rotation directions:
[1 0 0] --> [array([0, 1, 0]), array([0, 0, 1]), array([0. , 0.70710678, 0.70710678])]
[0 1 0] --> [array([1, 0, 0]), array([0, 0, 1]), array([0.70710678, 0. , 0.70710678])]
[0 0 1] --> [array([1, 0, 0]), array([0, 1, 0]), array([0.70710678, 0.70710678, 0. ])]
================================================================================
Parameters for the Brillouin zone sampling:
Number of k points: 1
K points in each directions: [1 1 1]
Parameters for the contour integral:
Eset: 100
Esetp: 10000
Ebot: -8.074511730000001 WARNING: This was automatically determined!
Etop: 0
================================================================================
Let’s visualize the contour and the Brilloun zone sampling, but first we have to import grogupy.viz for this.
[8]:
import grogupy.viz
system.contour.plot().show()
system.kspace.plot()
The single sample point of the Brillouin zone suggests that this could be the simulation of a single molecule. Let’s look at the atomic positions.
[9]:
system.plot_magnetic_entities()
If we have a large system with many magnetic entities it can be useful to see all the pairs connected to the magnetic entities. We can interactively toggle them on and off in the figure and rotate the structure to have a better look.
[10]:
system.plot_pairs()
Finally we can look at the Dzyaloshinskii-Moriya interaction.
[11]:
system.plot_DMI(rescale=0.1)
Or if we want to visualize multiple things at once we can add together the figures as they are standard plotly.graph_objs.Figure instances.
[12]:
system.plot_DMI(rescale=0.1).add_traces(system.plot_pairs(connect=True).data)